<%@page import="java.sql.Date"%>
<%@page import="form.ConnectionDB"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="model.Mucdanhgia"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<jsp:include page="Admin_includes/header.jsp"></jsp:include>

<div id="center-content">
	<div id="left">
		<jsp:include page="Admin_includes/left.jsp"></jsp:include>
	</div>
	<!-- end left -->







	<div id="right">
		<a href="Admin_danhgia.jsp" class="btlink">Danh sách đánh giá</a> <a
			href="Admin_themdanhgia.jsp" class="btlink">Thêm đánh giá</a>
		<fieldset>
			<table class="table1" width="740">
				<legend> Danh sách đánh giá</legend>
				<tr>
					<th>Id</th>
					<th>Hình</th>
					<th>Title</th>
					<th>Mục đánh giá</th>
					<th>Ngày Viết</th>
					<th>Ưu điểm</th>
					<th>Nhược điểm</th>
					<th>Nội dung</th>
					<th>Sửa</th>
					<th>Xóa</th>
				</tr>
				<%
					String sql = "select * from danhgia";
					String err="";
					ResultSet rs = null;
					Mucdanhgia mucdanhgia = new Mucdanhgia();
					int mucdanhgia_id = mucdanhgia.getMucdanhgia_id();
					try {
						rs = ConnectionDB.getConnection().createStatement()
								.executeQuery(sql);
						while (rs.next()) {
							int id = rs.getInt("danhgia_id");
							String hinh = rs.getString("hinh");
							String title = rs.getString("title");
							mucdanhgia_id = rs.getInt("mucdanhgia_id");
							Date ngayviet = rs.getDate("ngayviet");
							String uudiem = rs.getString("uudiem");
							String nhuocdiem = rs.getString("nhuocdiem");
							String noidung = rs.getString("noidung");
				%>
				<tr>
					<td><%=id%></td>
					<td><img src="<%=hinh%>" width="30" height="30"></td>
					<td><%=title%></td>
					<td><%=mucdanhgia_id%></td>
					<td><%=ngayviet%></td>
					<td><%=uudiem%></td>
					<td><%=nhuocdiem%></td>
					<td class="noidung" style="padding: 2px;">
						<form>
							<textarea name="" cols="" rows="" readonly
								style="width: 100px; height: 40px; margin: 0px; padding: 0px"><%=noidung%></textarea>

						</form>

					</td>
					<td class="suaxoa"><input type="submit" value="Sửa" name="sua"></input></td>
					<td class="suaxoa"><input type="submit" value="Xóa" name="Xóa"></input></td>
				</tr>
				<%
					}
				%>
				<%
					} catch (Exception e) {
						err = "Hệ thống chưa kết nối cơ sở dữ liệu!Chúng tôi sẽ nhanh chóng khắc phục!";
					}
				%>
			</table>
		</fieldset>
	</div>
	<label style="color:#EE2C2C; font-size: 18px; font-weight: bold;"><%=err%></label>
	<!-- end right -->

</div>
<!-- end center-content-->
<jsp:include page="Admin_includes/footer.jsp"></jsp:include>